package com.atguigu.Test04;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package com.atguigu.Test04
 * @date 2024/4/22 下午1:20
 */
@Component
public class JavaBean {

    //方案1.直接赋值
    //方案2.注解赋值 通常直接赋值,读取外部配置文件
    @Value("19")
    private String name;

@Value("${jdbc.username}")
    private String username;
    @Value("${jdbc.password}")
    private String password;


    @Override
    public String toString() {
        return "JavaBean{" +
                "name='" + name + '\'' +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
